package com.yyx.test;

import com.yyx.config.config;
import com.yyx.dao.UserDao;
import com.yyx.dao.UserDaoImpl;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;



public class test {
    public static void main(String[] args) {

        AnnotationConfigApplicationContext annotationConfigApplicationContext=
                new AnnotationConfigApplicationContext(config.class);
//        annotationConfigApplicationContext.getBean(UserDaoImpl.class);

        //手动注入BeanFactory
//        AnnotationConfigApplicationContext annotationConfigApplicationContext=
//                new AnnotationConfigApplicationContext();
//        annotationConfigApplicationContext.register(UserDaoImpl.class);
//        annotationConfigApplicationContext.refresh();
        UserDaoImpl userDao= annotationConfigApplicationContext.getBean(UserDaoImpl.class);

        userDao.query();

    }

}
